<template>
  <el-icon :size="iconSize" :color="iconColor">
    <component :is="modelValue || iconName" />
  </el-icon>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'AnvilIcon',
  // 不继承传入的size属性，否则会覆盖父组件的size属性
  inheritAttrs: false,
  props: {
    modelValue: {
      type: String,
      default: ''
    },
    iconName: {
      type: String,
      default: ''
    },
    iconSize: {
      type: Number,
      default: undefined
    },
    iconColor: {
      type: String,
      default: undefined
    }
  }
});
</script>
